package com.download.cn.download;

/**
 * 类功能描述：</br>
 *
 * @author zhuiji7
 * @email 470508081@qq.com
 * @version 1.0
 * </p>
 */

public class TaskInfo {
    private boolean isOnDownloading;//是否在下载
    private boolean isWaiting;//是否在等待
    private String taskID;
    private String fileName;
    private long fileSize = 0;
    private long downFileSize = 0;
    // 额外的备选的字段,不一定使用
    private String extraArgs1;
    private String extraArgs2;
    private String extraArgs3;
    private String extraArgs4;
    private String extraArgs5;





    public boolean isWaiting() {
        return isWaiting;
    }
    public void setWaiting(boolean waiting) {
        isWaiting = waiting;
    }

    public boolean isOnDownloading() {
        return isOnDownloading;
    }
    public void setOnDownloading(boolean isOnDownloading) {
        this.isOnDownloading = isOnDownloading;
    }
    public int getProgress() {
        if (fileSize == 0){
            return 0;
        }else{
            return ((int)(100 * downFileSize/fileSize));
        }

    }
    public String getTaskID() {
        return taskID;
    }
    public void setTaskID(String taskID) {
        this.taskID = taskID;
    }
    public String getFileName() {
        return fileName;
    }
    public void setFileName(String fileName) {
        this.fileName = fileName;
    }
    public String getFileType(){//文件类型
        String type = null;
        if(fileName != null){
            String name = fileName.toLowerCase();
            if (name.contains(".")) {
                type = name.substring(name.lastIndexOf("."), name.length());
            }
        }
        
        return type;
    }
    public long getFileSize() {
        return fileSize;
    }
    public void setFileSize(long fileSize) {
        this.fileSize = fileSize;
    }
    public long getDownFileSize() {
        return downFileSize;
    }
    public void setDownFileSize(long downFileSize) {
        this.downFileSize = downFileSize;
    }

    //
    public String getExtraArgs1() {
        return extraArgs1;
    }
    public void setExtraArgs1(String extraArgs1) {
        this.extraArgs1 = extraArgs1;
    }
    public String getExtraArgs2() {
        return extraArgs2;
    }
    public void setExtraArgs2(String extraArgs2) {
        this.extraArgs2 = extraArgs2;
    }
    public String getExtraArgs3() {
        return extraArgs3;
    }
    public void setExtraArgs3(String extraArgs3) {
        this.extraArgs3 = extraArgs3;
    }
    public String getExtraArgs4() {
        return extraArgs4;
    }
    public void setExtraArgs4(String extraArgs4) {
        this.extraArgs4 = extraArgs4;
    }
    public String getExtraArgs5() {
        return extraArgs5;
    }
    public void setExtraArgs5(String extraArgs5) {
        this.extraArgs5 = extraArgs5;
    }


    @Override
    public String toString() {
        return "TaskInfo{" +
                "isOnDownloading=" + isOnDownloading +
                ", isWaiting=" + isWaiting +
                ", taskID='" + taskID + '\'' +
                ", fileName='" + fileName + '\'' +
                ", fileSize=" + fileSize +
                ", downFileSize=" + downFileSize +
                ", extraArgs1='" + extraArgs1 + '\'' +
                ", extraArgs2='" + extraArgs2 + '\'' +
                ", extraArgs3='" + extraArgs3 + '\'' +
                ", extraArgs4='" + extraArgs4 + '\'' +
                ", extraArgs5='" + extraArgs5 + '\'' +
                '}';
    }
}
